﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;
using BLL;

namespace GUI
{
    public partial class FrmMain : DevComponents.DotNetBar.Office2007RibbonForm
    {
        public FrmMain()
        {
            InitializeComponent();
        }
        public void EnableAllMenu()
        {
            ribTabSapXep.Enabled = true;
            ribTabDiemDanh.Enabled = true;
        }

        public void EnableMenuQuanLy()
        {
            btnQuanLy.Enabled = true;
        }

        public void EnablebtnDangXuat()
        {
            btnDangXuat.Enabled = true;
            btnDoiMatKhau.Enabled = true;
            btnDangNhap.Enabled = false;
            btnDangKy.Enabled = false;
        }

        public void EnablebtnDangNhap()
        {
            btnDangNhap.Enabled = true;
            btnDangKy.Enabled = true;
            btnQuanLy.Enabled = false;
            btnDoiMatKhau.Enabled = false;
            btnDangXuat.Enabled = false;
        }

        public void EnablebtnDiemDanh()
        {
            btnDiemDanh.Enabled = true;
        }

        private void btnDangXuat_Click(object sender, EventArgs e)
        {
            MessageBoxEx.EnableGlass = false;
            DialogResult dr = MessageBoxEx.Show("Bạn Có Thật Sự Muốn Thoát?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (dr == DialogResult.Yes)
            {
                foreach(Form f in this.OwnedForms)
                {
                    f.Close();
                }
                EnablebtnDangNhap();
                var login = new FrmLogin();
                login.MdiParent = this;
                login.Show();
            }
        }

        private void btnThoat_Click(object sender, EventArgs e)
        {
            MessageBoxEx.EnableGlass = false;
            DialogResult dr = MessageBoxEx.Show("Bạn Có Thật Sự Muốn Thoát?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (dr == DialogResult.Yes)
            {
                Application.Exit();
            }
        }

        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            var login = new FrmLogin();
            //login.MdiParent = this;
            login.Show();
        }

        public void btnDangKy_Click(object sender, EventArgs e)
        {
            var dangKy = new FrmDangKy();
            //dangKy.MdiParent = this;
            dangKy.Show();
        }

        private void FrmMain_Load(object sender, EventArgs e)
        {
            ribTabSapXep.Enabled = false;
            ribTabDiemDanh.Enabled = false;
        }

        private void btnDoiMatKhau_Click(object sender, EventArgs e)
        {
            var doiPass = new frmDoiPass();
            doiPass.Show();
        }

        private void btnQuanLy_Click(object sender, EventArgs e)
        {
            var quanLy = new frmQuanLy();
            quanLy.Show();
        }

        private void btnGiangVien_Click(object sender, EventArgs e)
        {
            var giangVien = new frmGiangVien();
            giangVien.Show();
        }

        private void btnDiemDanh_Click(object sender, EventArgs e)
        {
            var diemDanh = new frmDiemDanh();
            diemDanh.Show();
        }

        private void btnSinhVien_Click(object sender, EventArgs e)
        {
            var sinhVien = new frmSinhVien();
            sinhVien.Show();
        }

        private void btnMonHoc_Click(object sender, EventArgs e)
        {
            var monHoc = new frmMonHoc();
            monHoc.Show();
        }

        private void btnKetQua_Click(object sender, EventArgs e)
        {
            var ketQua = new frmKetQua();
            ketQua.Show();
        }

        private void btnLop_Click(object sender, EventArgs e)
        {
            var lop = new frmLop();
            lop.Show();
        }

        private void btnCamThi_Click(object sender, EventArgs e)
        {
            var camThi = new frmCamThi();
            camThi.Show();
        }
    }
}